home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
c_lang
/
varinc.lzh
/
PAGE50B.C
< prev
next >
Wrap
Text File
|
1979-11-30
|
987b
|
17 lines
/* Loop until a nonspace character (may be null) is found. */
for (last_space = 0; text[last_space] == ' '; ++last_space)
; /* null statement for loop body */
/* strlen() returns the index of text's null character. */
len_text = strlen(text); /* Get string length of text. */
/* Loop: move characters back to replace leading spaces. Notice the use */
/* of the comma operator to perform two initializations and two step */
/* expressions in each loop. */
for (from_pos = last_space, to_pos = 0; /* loop initializer */
from_pos <= len_text; /* loop test */
++from_pos, ++to_pos) /* loop step */
text[to_pos] = text[from_pos]; /* loop body */
text[to_pos] = '\0'; /* new end of string for text */